*** Set working directory ***
cd "C:\..."

*********************** Load Data **********************************************
clear
graph drop _all
cap drop all

import excel "Data.xlsx", sheet("data") firstrow

************************** Setup ***********************************************
* Choose impulse response horizon
local hmax = 36

* Time variable
gen monthly_date = mofd(date)
format monthly_date %tm
drop date
rename monthly_date date
sort date
tsset date
egen time = group(date)
drop if date == .

* Standardize MP Shock series - unit standard deviation
egen mps_std = sd(chg_sveny02)
gen mps = chg_sveny02/mps_std
label var mps "MP shock"

sort date
tsset date

* Normalize GSCPI for 1998-2019 sample
rename gscpi gscpi_unscl
egen gscpi_mean = mean(gscpi_unscl)
gen gscpi_dm = gscpi_unscl - gscpi_mean
egen gscpi_std = sd(gscpi_dm)
gen gscpi = gscpi_dm/gscpi_std
label var gscpi "GSCPI"

************************* Figure A.2 *******************************************
*Panel (a)
twoway scatter mps gscpi
gr rename scatter1, replace

*Panel (b)
twoway scatter mps gscpi if mps != 0
gr rename scatter2, replace

gr combine scatter1 scatter2, rows(1) cols(2) graphregion(color(white)) plotregion(color(white)) 

********************************************************************************